Skip to content

Record a reindex heartbeat on every run for cron observability#10

Merged
BunsDev merged 1 commit into
mainfrom
cron-heartbeat
Jun 21, 2026
Merged

Record a reindex heartbeat on every run for cron observability#10
BunsDev merged 1 commit into
mainfrom
cron-heartbeat

Conversation

@BunsDev

@BunsDev BunsDev commented Jun 21, 2026

Copy link
Copy Markdown
Member

Makes scheduled cron runs observable.

Problem: Skipped/unchanged reindex runs leave no trace, and Vercel exposes no historical runtime-log or cron-run-history API on this plan. So a daily cron run that finds docs unchanged is invisible after the fact — there's no way to confirm it fired.

Fix: Persist a lightweight heartbeat to Redis key salem:docs:index:lastcheck on every evaluation (including skips): {checkedAt, trigger, status, reason, docsHash}.

  • recordCheck is optional on ReindexStateStore — existing/custom/test stores stay compatible.
  • The write is best-effort (try/catch); a heartbeat failure never fails the reindex.
  • reindexDocsIfChanged refactored to a single return so the heartbeat is recorded on all paths.

Result: every scheduled run is verifiable with one Redis read — confirms the 06:00 UTC cron is firing even when it's a no-op.

Verification: tsc --noEmit clean; reindex-freshness unit test passes. Built in an isolated worktree.

🤖 Generated with Claude Code

Skipped/unchanged reindex runs previously left no trace, so a scheduled
(cron) run that found docs unchanged was unobservable — Vercel exposes no
historical runtime-log or cron-run-history API on this plan.

Persist a lightweight heartbeat (checkedAt, trigger, status, reason,
docsHash) to Redis key `salem:docs:index:lastcheck` on every evaluation,
including skips. recordCheck is optional on ReindexStateStore so existing
and test stores stay compatible; the write is best-effort and never fails
the reindex. Now every scheduled run is verifiable with one Redis read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 21, 2026 07:49
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opencoven-chat-api Ready Ready Preview Jun 21, 2026 7:49am

@BunsDev BunsDev merged commit 7378e3d into main Jun 21, 2026
2 checks passed
@BunsDev BunsDev deleted the cron-heartbeat branch June 21, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds a persistent “heartbeat” record for each reindex evaluation (including no-op/skip runs) to make scheduled cron execution observable via a single Redis key read.

Changes:

  • Added ReindexHeartbeat + optional recordCheck() to ReindexStateStore for per-run heartbeat persistence.
  • Implemented Redis-backed heartbeat storage at salem:docs:index:lastcheck.
  • Refactored reindexDocsIfChanged to a single-return flow to ensure heartbeat recording on all decision paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants